<script setup>
defineProps({
  title: {
    type: String,
    required: true
  },
  isActive: {
    type: Boolean,
    default: false
  }
})

const emit = defineEmits(['select'])

const handleClick = () => {
  emit('select')
}
</script>

<template>
  <div 
    class="video-item"
    :class="{ active: isActive }"
    @click="handleClick"
  >
    <div class="video-border">
      <div class="video-icon">▶</div>
      <div class="video-content">
        <div class="video-title">{{ title }}</div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.video-item {
  cursor: pointer;
  width: 100%;
  margin-bottom: 0.5rem;
}

.video-border {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 24px;
  display: flex;
  align-items: center;
  transition: all 0.5s ease;
  background-color: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.video-border:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--card-shadow);
  border-color: var(--border-color-active);
  background-color: var(--card-hover-bg);
}

.video-item.active .video-border {
  border-color: var(--active-border-color, #4a90e2);
  background-color: var(--active-bg, rgba(74, 144, 226, 0.15));
  color: var(--text-color);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

.video-content {
  flex: 1;
  overflow: hidden;
  color: var(--text-color);
}

.video-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--icon-bg, #e6f0fd);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  color: var(--icon-color, #4a90e2);
  font-size: 16px;
}

.video-content {
  flex: 1;
  overflow: hidden;
}

.video-title {
  font-weight: 500;
  color: var(--text-color, #333);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-color-secondary, #666);
}

.dot {
  margin: 0 4px;
}

.duration {
  background-color: var(--duration-bg, rgba(0, 0, 0, 0.05));
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
  color: var(--text-color-secondary, #666);
}

/* 已在.video-item.active .video-border中定义 */

.active .video-icon {
  background-color: var(--active-icon-bg, #4a90e2);
  color: var(--active-icon-color, white);
}

/* 如果没有引入 iconfont，可以使用以下替代图标 */
.iconfont.icon-video::before {
  content: "▶";
}
</style>